import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from "../components/Home.vue";
import GreenPoints from "../components/GreenPoints.vue";
import CarbonReduce from "../components/CarbonReduce.vue";
import LevelInfo from "../components/LevelInfo.vue";
import LuckyWheel from "../components/LuckyWheel.vue";
import Classify from '../components/Classify.vue';
import Myself from '../components/Myself.vue';
import Mall from "../components/Mall.vue";
import Recommend from "../components/Recommend.vue";
import Details from "../components/Details.vue";
import BikeGame from "../components/BikeGame.vue";
import Exchange from "../components/Exchange.vue";
import FriendPK from "../components/FriendPK.vue";
import MeatyPlant from "../components/MeatyPlant.vue";
import Intelligent from "../components/Intelligent.vue";
import PublicBenefit from "../components/PublicBenefit.vue";
import CheckLove from "../components/CheckLove.vue";
import LightingCity from "../components/LightingCity.vue";
import KeepPets from "../components/KeepPets.vue";
// import LuckyWheel from "../components/LuckyWheel.vue"

Vue.use(VueRouter)


export default new VueRouter({
  routes: [{
      name: 'home',
      path: '/',
      component: Home,
      meta: {
        title: "我的主页"
      }
    },
    {
      name: 'greenpoints',
      path: '/greenpoints',
      component: GreenPoints,
      meta: {
        title: "绿色积分"
      }
    },
    {
      name: 'carbonreduce',
      path: '/carbonreduce',
      component: CarbonReduce,
      meta: {
        title: "碳减排量"
      }
    },
    {
      name: 'levelinfo',
      path: '/levelinfo',
      component: LevelInfo,
      meta: {
        title: "我的等级"
      }
    },
    {
      name: 'luckywheel',
      path: '/luckywheel',
      component: LuckyWheel,
      meta: {
        title: "抽奖"
      }
    },
    {
      path: '/Recommend',
      name: 'Recommend',
      component: Recommend,
      meta: {
        title: "优惠券"
      }
    },
    {
      path: '/Classify',
      name: 'Classify',
      component: Classify,
      meta: {
        title: "商品分类"
      }
    },
    {
      path: '/Myself',
      name: 'Myself',
      component: Myself,
      meta: {
        title: "商城个人中心"
      }
    },
    {
      path: '/Mall',
      name: 'Mall',
      component: Mall,
      meta: {
        title: "商城主页"
      }
    },
    {
      path: '/Details',
      name: 'Details',
      component: Details,
      meta: {
        title: "手机商品详情"
      }
    },
    {
      path: '/MeatyPlant',
      name: 'MeatyPlant',
      component: MeatyPlant,
      meta: {
        title: "多肉植物商品详情"
      }
    },
    {
      name: 'bikegame',
      path: '/bikegame',
      component: BikeGame,
      meta: {
        title: "单车游戏"
      }
    },
    {
      name: 'exchange',
      path: '/exchange',
      component: Exchange,
      meta: {
        title: "积分兑换"
      }
    },
    {
      name: 'FriendPK',
      path: '/FriendPK',
      component: FriendPK,
      meta: {
        title: "好友PK"
      }
    },
    {
      name: 'Intelligent',
      path: '/Intelligent',
      component: Intelligent,
      meta: {
        title: "智能助手"
      }
    },
    {
      name: 'PublicBenefit',
      path: '/PublicBenefit',
      component: PublicBenefit,
      meta: {
        title: "爱心公益"
      }
    },
    {
      name: 'CheckLove',
      path: '/CheckLove',
      component: CheckLove,
      meta: {
        title: "爱心记录"
      }
    },
    {
      name: 'LightingCity',
      path: '/LightingCity',
      component: LightingCity,
      meta: {
        title: "点亮无锡"
      }
    }, {
      name: 'KeepPets',
      path: '/KeepPets',
      component: KeepPets,
      meta: {
        title: "绿色宠物"
      }
    },
    // {
    //   name: 'LuckyWheel',
    //   path: '/LuckyWheel',
    //   component: LuckyWheel,
    //   meta: {
    //     title: "抽奖大转盘"
    //   }
    // }
  ],
  // 默认跳转后为界面顶部
  mode: 'history',
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return {
        x: 0,
        y: 0
      }
    }
  },
})